{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "任贤齐\n",
      "齐秦\n",
      "beyond\n",
      "陈慧琳\n",
      "邓丽君\n"
     ]
    }
   ],
   "source": [
    "import re\n",
    "html = '''<div id=\"songs-list\">\n",
    "    <h2 class=\"title\">经典老歌</h2>\n",
    "    <p class=\"introduction\">\n",
    "        经典老歌列表\n",
    "    </p>\n",
    "    <ul id=\"list\" class=\"list-group\">\n",
    "        <li data-view=\"2\">一路上有你</li>\n",
    "        <li data-view=\"7\">\n",
    "            <a href=\"/2.mp3\" singer=\"任贤齐\">沧海一声笑</a>\n",
    "        </li>\n",
    "        <li data-view=\"4\" class=\"active\">\n",
    "            <a href=\"/3.mp3\" singer=\"齐秦\">往事随风</a>\n",
    "        </li>\n",
    "        <li data-view=\"6\"><a href=\"/4.mp3\" singer=\"beyond\">光辉岁月</a></li>\n",
    "        <li data-view=\"5\"><a href=\"/5.mp3\" singer=\"陈慧琳\">记事本</a></li>\n",
    "        <li data-view=\"5\">\n",
    "            <a href=\"/6.mp3\" singer=\"邓丽君\">但愿人长久</a>\n",
    "        </li>\n",
    "    </ul>\n",
    "</div>'''\n",
    "#res=re.search('<a href=\".*?\" singer=\"(.*?)\">(.*?).*?</a>',html)\n",
    "res=re.findall('<a href=\".*?\" singer=\"(.*?)\">(.*?)</a>',html)\n",
    "for i in res:\n",
    "    print(i[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extra things hello 123455 7890 World_this is a regex Demo extra things\n"
     ]
    }
   ],
   "source": [
    "import re\n",
    "content = \"Extra things hello 123455 World_this is a regex Demo extra things\"\n",
    "#res=re.sub('(\\d+)','',content)\n",
    "res=re.sub('(\\d+)',r'\\1 7890',content)\n",
    "print(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fujun\n",
      "fuwen\n",
      "<__main__.student object at 0x000002316B55B7B8>\n"
     ]
    }
   ],
   "source": [
    "class people():\n",
    "    def __init__(self,name,age):\n",
    "        self.name=name\n",
    "        self.age=age\n",
    "        print('fuwen')\n",
    "class student(people):\n",
    "    def __init__(self):\n",
    "        self.name='fujun'\n",
    "        print(self.name)\n",
    "        super().__init__('fuda',45)\n",
    "res=student()\n",
    "print(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
